/*
 * main.cpp
 *
 *  Created on: Feb 1, 2009
 *      Author: tandaica0612
 */
#include <sqlite3.h>
#include <iostream>
using namespace std;
/*
 *Chú ý khi sử dụng phải thêm vào tùy chọn "-lsqlite3" khi biên dịch để linker library
 */
int main(){
	sqlite3* ppDb;
	sqlite3_stmt* stmt;
	int isOk;
	isOk = sqlite3_open("data.db",&ppDb);
	cout << isOk << endl;
	isOk = sqlite3_prepare(ppDb,"select * from tb_cards",0,&stmt,0);
	cout << isOk << endl;
	while((isOk = sqlite3_step(stmt)) != SQLITE_DONE){
		switch(isOk){
		case SQLITE_ROW:
			int n = sqlite3_column_count(stmt);
			for(int i=0; i<n; i++) {
				cout << sqlite3_column_text(stmt,i) << endl;
			}
		}
	}
	sqlite3_finalize(stmt);
	sqlite3_close(ppDb);
}
